--[[ 编码: WMS-33-20 名称: 指定出库-WFP-状态检查 作者:HAN 日期:2025-1-29 级别:项目 函数: CheckState 功能: -- 查询一下【指定出库】是否可以完成(会有多个容器出库) 更改记录: --]] wms_base = require ("wms_base") function CheckState ( strLuaDEID ) local nRet, strRetInfo local specify_outbound = {} nRet, specify_outbound = m3.GetCurEditDataObj( strLuaDEID ) if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【指定出库】对象属性失败!"..specify_outbound ) end -- 检查指定出库容器状态 -- N_B_STATE = 2, 3, 4 local strCondition = "S_SO_NO = '"..specify_outbound.so_no.."' AND N_B_STATE >= 2" nRet, strRetInfo = mobox.getDataObjCount( strLuaDEID, "Specify_Outbound_CNTR", strCondition ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "getDataObjCount失败!"..strRetInfo ) end local nCount = lua.StrToNumber( strRetInfo ) -- 更新【指定出库】的状态和已完出库数量 if ( specify_outbound.cntr_total == nCount ) then -- 3 完成 strSetAttr = "N_B_STATE = 3, N_ACC_FINISH = "..nCount else strSetAttr = "N_ACC_FINISH = "..nCount end strCondition = "S_SO_NO = '"..specify_outbound.so_no.."'" nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Specify_Outbound", strCondition, strSetAttr ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【Specify_Outbound】信息失败!"..strRetInfo ) end end